package hihocoder;
import java.util.ArrayList;
import java.util.Scanner;

public class LittleChance {

	public static ArrayList<Long> yueshu(long a) {
		ArrayList<Long> result=new ArrayList<>();
		for(int i=1;i<Math.sqrt(a);i++){
			if(a%i==0){
				result.add((long)i);
				result.add((a/i));
			}
		}
		double sq=Math.sqrt(a);
		if(sq*sq==a)
			result.add((long)sq);
		return result;
	}
	
	public static long[] huzhi(long a,long c) {
		long m=a;
		long n=c;
		long gcd=1;
		while (m%n!=0) {
			long tmp=m%n;
			m=n;
			n=tmp;
		}
		gcd=n;
		a/=gcd;
		c/=gcd;
		return new long[]{a,c};
	}
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		long A=scanner.nextLong();
		long B=scanner.nextLong();
		ArrayList<Long> aList=yueshu(A);
		ArrayList<Long> bList=yueshu(B);
		long aCount=aList.size();
		long bCount=bList.size();
		
		aList.retainAll(bList);//求交集
		long cCount=aList.size();
		//结果是 cCount/(aCount*bCount)
		long[] r=huzhi(aCount*bCount, cCount);
		System.out.println(r[0]+" "+r[1]);
	}
}
